<?php
declare (strict_types = 1);

namespace app\common\customer\model;

use app\common\config\logic\DictionaryLogic;
use app\common\config\model\ConfigStatus;
use app\common\product\logic\StoreCategoryLogic;
use think\Model;
use think\model\concern\SoftDelete;

class CustomerTag extends Model
{
    protected $table = "tk_member_tag";

    use SoftDelete;
    protected $defaultSoftDelete = 0;

    protected $type = [
    ];

    public function getCategoryTitleAttr($value, $data) {
        $categoryLogic = new StoreCategoryLogic();
        $row = $categoryLogic->getStoreCategory($data['category_id']);

        return !empty($row) ? $row['title'] : "";
    }

    public function getStatusTitleAttr($value, $data) {
        $dictionaryLogic = new DictionaryLogic();
        $row = $dictionaryLogic->getItem($data['status'], ConfigStatus::class);
        return !empty($row) ? $row['title'] : "";
    }
}
